package edu.upc.ejemplos.stringcalculator;

public class StringCalculator {

	public int add(String valor) {
		
		if(valor.length()==0) return 0;		
		String[] values = valor.split(",");
		return suma(values);
		
	}

	private int suma(String[] values) {
		int total = 0;
		for(String value : values){
			total = total + Integer.parseInt(value);
		}		
		return total;
	}
	

}
